package com.LA_houseLease.common.mybatisplus;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class MybatisPlusConfiguration {


    /**
     * MybatisPlus的拦截器
     * 配置mybatisPlus插件
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        log.warn("MybatisPlus拦截器.......配置mybatisPlus插件........");
        MybatisPlusInterceptor interceptor=new MybatisPlusInterceptor();
        //在拦截器中添加MybatisPlus的分页插件PaginationInnerInterceptor
        //如果配置多个插件, 切记分页最后添加
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        //如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
        return interceptor;
    }


}
